home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / DevTools / eText5 / Source / ChooseEncoding.bproj / ChooseEncoding.m < prev    next >
Encoding:
Text File  |  1995-02-11  |  1.9 KB  |  58 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //    FILENAME:    ChooseEncoding.m
  3. //    SUMMARY:    Implementation of a Tool-based UI for eText HTML Encoders
  4. //    SUPERCLASS:    Object
  5. //    INTERFACE:    None
  6. //    PROTOCOLS:    <Tool>
  7. //    AUTHOR:        Rohit Khare
  8. //    COPYRIGHT:    (c) 1994 California Institure of Technology, eText Project
  9. ///////////////////////////////////////////////////////////////////////////////
  10. //    DESCRIPTION: This is a custom class designed to provide a UI for a 
  11. //    UI-less hook of eText: allowing the user to choose between different
  12. //    encoding tables for HTML character mappping.
  13. ///////////////////////////////////////////////////////////////////////////////
  14. //    HISTORY
  15. //    10/31/94:    Created. Implemented in just minutes, from scratch.
  16. ///////////////////////////////////////////////////////////////////////////////
  17.  
  18. #import "ChooseEncoding.h"
  19.  
  20. @implementation ChooseEncoding
  21.  
  22. + new 
  23. {
  24.     static ChooseEncoding *ce = nil;
  25.     
  26.     if (!ce) {
  27.         ce = [[ChooseEncoding alloc] init];
  28.     }
  29.     return ce;
  30. }
  31.  
  32. + toolAwake:theApp
  33. {
  34.     [theApp registerAccessory:NXUniqueString("Choose HTML Encoding")
  35.                 key:'\0'
  36.                name:NXUniqueString("ChooseEncoding")
  37.              target:[ChooseEncoding new]
  38.              action:@selector(activate:)];
  39.     return self;
  40. }
  41.  
  42. - init {return [super init];}
  43.  
  44. - free {return self;}
  45.  
  46. - activate:sender
  47. {
  48.     int choice = NXRunAlertPanel("Choose Encoding...","You can optimize the HTML generated to work around particular clients. To permanently change your default encoding, \"dwrite eText HTMLEncoding Type\" (look in the app wrapper).", "Strict HTML","ASCII","OmniWeb");
  49.     switch (choice) {
  50.         case NX_ALERTDEFAULT: NXSetDefault([NXApp appName], "HTMLEncoding", "WebStep"); break;
  51.         case NX_ALERTALTERNATE: NXSetDefault([NXApp appName], "HTMLEncoding", "ASCII"); break;
  52.         case NX_ALERTOTHER: NXSetDefault([NXApp appName], "HTMLEncoding", "OmniWeb"); break;
  53.     }
  54.     [eText flushHTMLEncoding]; // yeah, it's a memory leak. so f*cking sue me.
  55.     return self;
  56. }
  57.  
  58. @end